package com.classic.base;

import android.os.Handler;
import android.support.annotation.DrawableRes;
import android.util.Log;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.classic.content.contents;
import com.classic.duanzhi.R;
import com.classic.utils.UtilsPrivacyPolicy;


public abstract class UBaseQYSplashActivity extends UBaseActivity {
    ImageView img;
    UtilsPrivacyPolicy u_utils;

    protected abstract @DrawableRes
    int getImg();

    @Override
    protected int getResourceId() {
        return R.layout.activity_splash_u;
    }

    /**
     * 只用于初始化当前app需要实例化的内容  不适用当前页面初始化数据
     */
    protected abstract void initData();

    public void initUContent() {

    }

    @Override
    protected void initView() {
        initUContent();
        img = findViewById(R.id.v_iv_img);
        u_utils = findViewById(R.id.u_utils);
        ImageView ivLogo = findViewById(R.id.iv_logo);
        Glide.with(UBaseQYSplashActivity.this).load(getImg()).into(img);
        Glide.with(UBaseQYSplashActivity.this).load(getImgLogo()).into(ivLogo);

        initData();
        u_utils.setOnUtilsPrivacyPolicyListener(new UtilsPrivacyPolicy.OnUtilsPrivacyPolicyListener() {
            @Override
            public void onPermission() {//允许进入 进行操作
                initADType(1);
            }
        });
    }
    protected abstract String getChannel();

    /**
     * 请求广告
     *
     * @param index 0 无广告 1 有广告
     */
    public void initADType(int index) {
        if (index == 0) {
            starMain(1);
        } else {


        }

    }

    @Override
    protected void onResume() {
        super.onResume();

    }

    @Override
    protected void onPause() {
        super.onPause();

    }

    /**
     * 跳转到主页
     *
     * @param i 当前跳转值
     */
    public abstract void starMain(int i);



    /**
     * @return 启动页显示图片
     */
    protected abstract @DrawableRes
    int getImgLogo();


    /**
     * @param height
     * @return 动态计算logo高度 适配屏幕
     */
    public abstract double getImgLogoScale(int height);
}
